﻿using System;
using Crossroad.OAuth.Attributes;
using Crossroad.System.Api;
using Crossroad.Utils.Extensions;
using Microsoft.AspNetCore.Mvc;

namespace Crossroad.System.Common.Controller
{
    [ApiAuthorize]
    [Route("api/common/date-time")]
    public class DateController : BaseApi
    {
        [HttpGet("now")]
        public object Index()
        {
            return DateTime.Now.ToDateTimeStr();
        }

        [HttpGet("today")]
        public object Today()
        {
            return DateTime.Now.ToDateStr();
        }

        [HttpGet("current-year/range")]
        public object CurrentYearRange()
        {
            var year = DateTime.Now.Year;
            return new
            {
                startDate = $"{year}-01-01",
                endDate = $"{year}-12-31"
            };
        }


    }
}